using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.Security;
using Sueetie.Core;

public partial class site : SueetieBaseMasterPage
{
  protected void Page_Load(object sender, EventArgs e)
  {
      if (!IsPostBack)
      {
          MembershipUser user = Membership.GetUser();

          AdminLink.NavigateUrl = "/admin/default.aspx";
          if (!Page.User.IsInRole("BlogAdministrator"))
          {
              AdminLI.Visible = false;
              AdminLink.Visible = false;
          }
          BlogAdminLink.NavigateUrl = "../../admin/Pages/Add_entry.aspx";
          if (!Page.User.IsInRole("SiteBlogEditor"))
          {
              BlogAdminLI.Visible = false;
              BlogAdminLink.Visible = false;
          }
          UserLink.Text = "Welcome, Guest!";
          UserLink.NavigateUrl = "/members/login.aspx";
          if (Page.User.Identity.IsAuthenticated)
          {
              UserLink.Text = "Welcome, " + CurrentSueetieUser.Profile.DisplayName + "!";
              UserLink.NavigateUrl = "/members/myaccountinfo.aspx";
          }
          if (Page.User.Identity.IsAuthenticated)
              RegisterLI.Visible = false;

          if (CurrentSueetieUser.HasAvatarImage)
          {
              AvatarLink.ImageUrl = "/images/avatars/" + CurrentUserID.ToString() + "t.jpg?d=" + DateTime.Now.ToLongTimeString();
              AvatarLink.NavigateUrl = "/members/myaccountinfo.aspx?iv=1";
          }
          else
              AvatarLink.ImageUrl = "/images/avatars/noavatarthumbnail.jpg";
      }
  }

}
